package oocis.oocisSharing;

import java.util.*;
import java.io.File;
import oocis.util.*;

public class Database {
	public Database(Server _server){
		server = _server;
		dataList = server.getList();
	}
	
	private LinkedList <Item> dataList;
	private Server server;
	
	public boolean put(Item _item){
		dataList.add(_item);
		return true;
	}
	
	public boolean remove(Item _item){
		Iterator <Item> iter = dataList.iterator();
		while (iter.hasNext() && (!iter.next().sameTo(_item)));
		iter.remove();
		return true;
	}
	
	public boolean modify(Item _item){
		Iterator <Item> iter = dataList.iterator();
		while (iter.hasNext() && (!iter.next().sameTo(_item)));
		iter.remove();
		dataList.add(_item);
		return true;
	}
	
	public boolean upload(Item _item, File _file){
		return server.upload(_file) && put(_item);
	}
	
	public boolean update(Item _item, Item _newItem){
		return false;
		
	}

	public LinkedList search(Item _item){
		return null;
		
	}
	
	public boolean getList(){
		return false;
		
	}
}
